﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

public partial class Claims_Test : System.Web.UI.Page
{

    private GridEditFormItem item;
    private RadTextBox test;

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void RadGridClaims_SelectedIndexChanged(object sender, EventArgs e)
    {
        int claimId = (int)RadGridClaims.SelectedValue;

        Response.Redirect("~/Claims/PrintEN.aspx?id=" + claimId.ToString());
    }

  

    protected void RadGridClaims_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode))
        {
            
        }
    }
    protected void ldsRejectedItems_Inserted(object sender, LinqDataSourceStatusEventArgs e)
    {
        
    }
    protected void ldsRejectedItems_Inserting(object sender, LinqDataSourceInsertEventArgs e)
    {
        RejectedItem item = e.NewObject as RejectedItem;

        e.Cancel = true;
     
        foreach(GridDataItem dataItem in RadGridClaims.Items)
        {
            if (dataItem.Expanded == true)
            {
                int index = dataItem.ItemIndex;
                int claimId = (int)RadGridClaims.MasterTableView.DataKeyValues[index]["ClaimId"];
                item.ClaimId = claimId;
                ItemsDAL.InsertRejectedItem(item);

                break;
            }
        }

        
    }
}
